﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Runtime.Serialization;

namespace ICeFramework.Win.UI.FSWatcher
{
    [Serializable]
    public class FSWatcherItem
    {
        private FSWatcherItemType _itemType;
        #region public FSWatcherItemType Type
        /// <summary>
        /// Get/Sets the Type of the FSWatcherItem
        /// </summary>
        /// <value></value>
        [XmlAttribute]
        public FSWatcherItemType Type
        {
            get { return _itemType; }
            set { _itemType = value; }
        }
        #endregion

        private string _fullPath;
        #region public string FullPath
        /// <summary>
        /// Get/Sets the FullPath of the FSWatcherItem
        /// </summary>
        /// <value></value>
        [XmlAttribute]
        public string FullPath
        {
            get { return _fullPath; }
            set { _fullPath = value; }
        }
        #endregion

        private string _oldFullPath;
        #region public string OldFullPath
        /// <summary>
        /// Get/Sets the OldFullPath of the FSWatcherItem
        /// </summary>
        /// <value></value>
        [XmlAttribute]
        public string OldFullPath
        {
            get { return _oldFullPath; }
            set { _oldFullPath = value; }
        }
        #endregion

        private FSWatcherEventType _eventType;
        #region public FSWatcherEventType EventType
        /// <summary>
        /// Get/Sets the EventType of the FSWatcherItem
        /// </summary>
        /// <value></value>
        [XmlAttribute]
        public FSWatcherEventType EventType
        {
            get { return _eventType; }
            set { _eventType = value; }
        }
        #endregion

        public FSWatcherItem(FSWatcherItemType itemType, string fullPath, string oldFullPath, FSWatcherEventType changeType)
        {
            _itemType = itemType;
            _fullPath = fullPath;
            _oldFullPath = oldFullPath;
            _eventType = changeType;
        }

        public FSWatcherItem()
        {

        }

        public override bool Equals(object obj)
        {
            if (obj == null || obj as FSWatcherItem == null)
            {
                return false;
            }

            return this._fullPath == (obj as FSWatcherItem).FullPath && this._oldFullPath == (obj as FSWatcherItem).OldFullPath && this.EventType == (obj as FSWatcherItem).EventType;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
